<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Decodes the value of a JSON string located at the requested JSON pointer.</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.simdjson-key-exists.html">« simdjson_key_exists</a></li>
      <li style="float: right;"><a href="class.simdjsonexception.html">SimdJsonException »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.simdjson.html">Simdjson 函数</a></li>
    <li>Decodes the value of a JSON string located at the requested JSON pointer.</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.simdjson-key-value" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">simdjson_key_value</h1>
  <p class="verinfo">(PECL simdjson &gt;= 2.0.0)</p><p class="refpurpose"><span class="refname">simdjson_key_value</span> &mdash; <span class="dc-title">Decodes the value of a JSON string located at the requested JSON pointer.</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.simdjson-key-value-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>simdjson_key_value</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">string</span> <code class="parameter">$json</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">string</span> <code class="parameter">$key</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">bool</span> <code class="parameter">$associative</code><span class="initializer"> = <strong><code>false</code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">int</span> <code class="parameter">$depth</code><span class="initializer"> = 512</span></span><br>): <span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span></div>

  <p class="para rdfs-comment">
   Decodes and returns the value found at the requested JSON pointer.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.simdjson-key-value-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt>
<code class="parameter">json</code></dt>

    <dd>

     <p class="para">
      The <code class="parameter">json</code> <span class="type">string</span> being queried and decoded.
     </p>
      <p class="para">
       This function only works with UTF-8 encoded strings.
      </p>
      <p class="para">
       This function parses valid inputs which
       <span class="function"><a href="function.json-decode.html" class="function">json_decode()</a></span> can decode,
       provided that they are less than 4 GiB long.
      </p>
    </dd>

   
   
    <dt>
<code class="parameter">key</code></dt>

    <dd>

     <p class="para">
      The JSON pointer <span class="type">string</span>.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">associative</code></dt>

    <dd>

     <p class="para">
      When <strong><code>true</code></strong>, JSON objects will be returned as
      associative <span class="type">array</span>s; when <strong><code>false</code></strong>, JSON objects will be returned as <span class="type">object</span>s.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">depth</code></dt>

    <dd>

     <p class="para">
      Maximum nesting depth of the structure being decoded.
      The value must be greater than <code class="literal">0</code>,
      and less than or equal to <code class="literal">2147483647</code>.

      Callers should use reasonably small values,
      because larger depths require more buffer space and will
      increase the recursion depth, unlike the current <span class="function"><a href="function.json-decode.html" class="function">json_decode()</a></span> implementation.
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.simdjson-key-value-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns the part of the value encoded in <code class="parameter">json</code>
   that <code class="parameter">key</code> refers to in appropriate
   PHP type. Values <code class="literal">true</code>, <code class="literal">false</code> and
   <code class="literal">null</code> are returned as <strong><code>true</code></strong>, <strong><code>false</code></strong> and <strong><code>null</code></strong>
   respectively.
  </p>
 </div>

 <div class="refsect1 errors" id="refsect1-function.simdjson-key-value-errors">
  <h3 class="title">错误／异常</h3>
  <p class="para">
   If <code class="parameter">json</code> or <code class="parameter">key</code> is invalid,
   or <code class="parameter">key</code> could not be found within <code class="parameter">json</code>,
   a <span class="classname"><a href="class.simdjsonexception.html" class="classname">SimdJsonException</a></span> is thrown as of PECL simdjson 2.1.0,
   while previously, a <span class="classname"><a href="class.runtimeexception.html" class="classname">RuntimeException</a></span> was thrown.
  </p>
  <p class="para">
   If <code class="parameter">depth</code> is outside the allowed range,
   a <span class="classname"><a href="class.simdjsonvalueerror.html" class="classname">SimdJsonValueError</a></span> is thrown as of PECL simdjson 3.0.0,
   while previously, an error of level <strong><code>E_WARNING</code></strong> was raised.
  </p>
 </div>

 <div class="refsect1 seealso" id="refsect1-function.simdjson-key-value-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.json-encode.html" class="function" rel="rdfs-seeAlso">json_encode()</a> - 对变量进行 JSON 编码</span></li>
    <li class="member"><span class="function"><a href="function.simdjson-decode.html" class="function" rel="rdfs-seeAlso">simdjson_decode()</a> - Decodes a JSON string</span></li>
   </ul>
  </p>
 </div>

</div></div></div></body></html>